package com.transaction.demo.base.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.transaction.demo.common.util.Result;
import com.transaction.demo.common.util.ResultPage;
import com.transaction.demo.base.vo.req.SysDictTypeListReqVo;
import com.transaction.demo.base.vo.req.SysDictTypeAddReqVo;
import com.transaction.demo.base.vo.req.SysDictTypeUpdateReqVo;
import com.transaction.demo.base.vo.resp.SysDictTypeRespVo;
import com.transaction.demo.base.service.SysDictTypeService;

/**
 * 描述：字典类型表
 * 作者：马庆智
 * 日期：2023/03/28 17:07:14
 */
@Api(tags = "字典类型表")
@RestController
@RequestMapping("/sysDictType")
public class SysDictTypeController {

	@Autowired
	private SysDictTypeService sysDictTypeService;

	/**
	 * 查询字典类型表列表
	 *
	 * @param record 请求参数
	 * @return SysDictTypeResp
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("查询字典类型表列表")
	@PostMapping("/querySysDictTypeList")
	public Result<ResultPage<SysDictTypeRespVo>> querySysDictTypeList(@RequestBody @Valid SysDictTypeListReqVo record) {
		return Result.success(sysDictTypeService.querySysDictTypeList(record));
	}

	/**
	 * 添加字典类型表
	 *
	 * @param record 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("添加字典类型表")
	@PostMapping("/saveSysDictType")
	public Result<Integer> saveSysDictType(@RequestBody @Valid SysDictTypeAddReqVo record) {
		return Result.success(sysDictTypeService.saveSysDictType(record));
	}

	/**
	 * 删除字典类型表
	 *
	 * @param ids 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("删除字典类型表")
	@GetMapping("/deleteSysDictType")
	public Result<Integer> deleteSysDictType(String ids) {
		return Result.success(sysDictTypeService.deleteSysDictType(ids));
	}

	/**
	 * 更新字典类型表
	 *
	 * @param record 请求参数
	 * @return Result<Integer>
	 * @author 马庆智
	 * @date: 2023/03/28 17:07:14
	 */
	@ApiOperation("更新字典类型表")
	@PostMapping("/updateSysDictType")
	public Result<Integer> updateSysDictType(@RequestBody @Valid SysDictTypeUpdateReqVo record) {
		return Result.success(sysDictTypeService.updateSysDictType(record));
	}

}